home *** CD-ROM | disk | FTP | other *** search
/ A is for ART, C is for Cezanne / A is for ART, C is for Cezanne.iso / mac / MEDIA / CEZANNE.DIR / 00007_Script_MUSEUM SCRIPTS < prev    next >
Text File  |  1996-05-28  |  12KB  |  337 lines

  1. GLOBAL gScreen, gMainArtList, gPainting, gDot, gBGchan, gMusList, hand ,fist, hdPath
  2. GLOBAL mMover, gWallNo, gPicsOnWall, gBinList, gMaskL,gCursL,gMaskR, gCursR
  3. GLOBAL gWallList1,gWallList2,gWallList3,gWallList4,gWallList5,gBinLocList, gRulerON
  4. ---------------------  MUSEUM SCRIPTS  ----------------------------------
  5.  
  6. on setUpMuseumLists
  7.   set gCursR = member "cursR" of castLib "MUSEUM"
  8.   set gMaskR = member "maskR" of castLib "MUSEUM"
  9.   set gCursL = member "cursL" of castLib "MUSEUM"
  10.   set gMaskL = member "maskL" of castLib "MUSEUM"
  11.   set gMusList = value(line 2 of field "museumInfo" of castLib "USER")
  12.   set gBinList = value(line 4 of field "museumInfo" of castLib "USER")
  13.   set gWallList1 = value(line 6 of field "museumInfo" of castLib "USER")
  14.   set gWallList2 = value(line 8 of field "museumInfo" of castLib "USER")
  15.   set gWallList3 = value(line 10 of field "museumInfo" of castLib "USER")
  16.   set gWallList4 = value(line 12 of field "museumInfo" of castLib "USER")
  17.   set gWallList5 = value(line 14 of field "museumInfo" of castLib "USER")
  18.   set gRulerON = EMPTY
  19. end
  20.  
  21. on enterMuseum
  22.   set mMover = 40
  23.   set gWallNo = 1
  24.   -- set the stretch of sprite 34 = FALSE
  25.   setUpBin
  26.   changeMuseumRoom
  27.   puppetSprite mMover, TRUE 
  28.   set the constraint of sprite mMover = 2 ---- WallRect
  29. END
  30.  
  31. on setUpBin
  32.   repeat with x = 35 to 37
  33.     puppetsprite x, TRUE
  34.     set the member of sprite x = gDot
  35.   end repeat
  36.   set gBinLocList = [point(432,370), point(428,384), point(424,380)]
  37.   ----- loc of sprite 37 holds position 1 in list, 12 holds 2, etc)
  38.   set the cursor of sprite mMover = fist
  39.   showBin
  40. end
  41.  
  42. on showBin
  43.   set the cursor of sprite 37 = hand
  44.   set the stretch of sprite 37 =  0
  45.   set the member of sprite 33 = the number of member "binBack.pic" of castlib "MUSEUM"
  46.   set the loc of sprite 33 = point(427, 372)
  47.   set the stretch of sprite 33 = 0
  48.   set the member of sprite 38 = the number of member "binFront.pic" of castlib "MUSEUM"
  49.   set the isOn of (getProp(the btnList of gScreen,18)) = TRUE  --binRemBtn
  50.   resetBinBtn (getProp(the btnList of gScreen,19)) --remCloseBtn
  51.   repeat with x = 37 down to (38 - min(count(gBinList),3))
  52.     ------ counting up 1,2,3 in list  (37-->1,36-->2, 35-->3)
  53.     set the loc of sprite x = getAt(gBinLocList, 38-x)    
  54.     ------ counting up 1,2,3 in list (37-->1,36-->2, 35-->3)
  55.     set pic = getAt(gBinList,38-x)
  56.     set the member of sprite x = the number of member ("BN_"& pic) of castLib "MUSEUM"
  57.   end repeat
  58. END
  59.  
  60. on toggleRuler
  61.   if gRulerON = EMPTY then 
  62.     set gRulerON = "R"
  63.     renameBtn getProp(the btnList of gScreen, 16), "rulerOffBtn"
  64.   else 
  65.     set gRulerON = EMPTY
  66.     renameBtn getProp(the btnList of gScreen, 16), "rulerBtn"
  67.   end if
  68.   ------ MUS_WR2.PIC or MUS_W2.PIC etc.
  69.   set the member of sprite gBGchan = the number of member ("MUS_W" & gRulerON & gWallNo & ".PIC") of castLib "MUSEUM"
  70. end 
  71.  
  72. on changeMuseumRoom
  73.   puppetSound member "NEWROOM.AIF" of castLib "MUSEUM"
  74.   set thisWallList = value("gWallList" & gWallNo)
  75.   set gPicsOnWall = count(thisWallList)
  76.   repeat with x = 22 to 31
  77.     puppetSprite x, TRUE
  78.     set the cursor of sprite x =  hand
  79.     if (gPicsOnWall < (x-21)) then
  80.       set the member of sprite x = gDot
  81.     else
  82.       set name =  string(getPropAt(thisWallList, x-21))
  83.       set the member of sprite x =  the number of member ("UP_" & name) of castLib "MUSEUM"
  84.       set the loc of sprite x = getAt( thisWallList , x-21)
  85.     end if
  86.   end repeat
  87.   ------ MUS_WR2.PIC or MUS_W2.PIC etc.
  88.   set the member of sprite gBGchan = the number of member ("MUS_W" & gRulerON & gWallNo& ".PIC") of castLib "MUSEUM"
  89. end
  90.  
  91. on removeFromMuseum
  92.   if the member of sprite 37 = gDot then exit
  93.   set picNo =  chars (the name of the member of sprite 37, 4,7)  -- BN_P1
  94.   set the member of sprite 37 = gDot
  95.   deleteOne(gBinList, picNo)
  96.   updateStage
  97.   if count(gBinList) > 0 then
  98.     ------ move loc in binLocList from 1 to new position after back picture
  99.     addAt(gBinLocList, min(4,(count(gBinList)+2)),getAt(gBinLocList,1))
  100.     deleteAt(gBinLocList,1)
  101.   end  if
  102.   moveBinPicsForward
  103.   set num = getPos(gMusList,value("#"&picNo))
  104.   deleteAt(gMusList,num)
  105.   set the inMuseum of (getProp(gMainArtList,value("#"&picNo))) = FALSE
  106. end
  107.  
  108. on dragToWall  spriteNum
  109.   set picNo =  chars (the name of the member of sprite spriteNum,4,7)  -- BIN_P1
  110.   cursor fist
  111.   holdON 8
  112.   if NOT the stillDown then 
  113.     cursor hand
  114.     puppetSound "splodge.aif"
  115.     updateStage
  116.     moveFrontToHOLD picNo 
  117.     moveBinPicsForward
  118.     moveHOLDtoBack
  119.   else
  120.     set the cursor of sprite spritenum = fist
  121.     removeFromBin picNo
  122.     dragAround mMover
  123.     if gPicsOnWall < 10 AND NOT withinBin() then  --  sprite 2 = wallRect, 33 = binBack / rollover(2) AND 
  124.       shiftBinLocsForward
  125.       moveBinPicsForward
  126.       placeOnWall picNo
  127.     else 
  128.       returnToBin picNo
  129.     end if
  130.     set the member of sprite mMover = gDot
  131.     set the cursor of sprite spritenum = hand
  132.   end if
  133.   cursor hand
  134. END
  135.  
  136. on withinBin
  137.   if rollover(33) OR (sprite mMover within 33) then return TRUE
  138.   else return FALSE
  139. end 
  140.  
  141. on removeFromBin picNo
  142.   set the loc of sprite mMover = point(the mouseH, the mouseV)
  143.   set the member of sprite mMover = the number of member ("UP_"&picNo) of castLib "MUSEUM"
  144.   set the member of sprite 37 = gDot
  145.   ------ remove from BinList
  146.   deleteOne(gBinList, picNo)
  147.   -- updateStage
  148. END
  149.  
  150. on moveFrontToHOLD picNo
  151.   if count(gBinList) >1 then  --there is something to move
  152.     ------ change BinList
  153.     deleteAt(gBinList,1)
  154.     add(gBinList, picNo)
  155.     ------ change binLocList
  156.     addAt(gBinLocList, min(4,(count(gBinList)+1)),getAt(gBinLocList,1))
  157.     deleteAt(gBinLocList,1)
  158.   end if
  159. END
  160.  
  161. on moveHOLDtoBack
  162.   if count(gBinList) < 4 then
  163.     ------ show in back of bin
  164.     set num = count(gBinList)
  165.     set picNo = getAt(gBinList,num)
  166.     set the member of sprite (38- num) =  the number of member ("BN_"&picNo) of castLib "MUSEUM"
  167.     set the loc of sprite (38-num) = getAt(gBinLocList,num)
  168.   end if
  169. END
  170.  
  171. on shiftBinLocsForward
  172.   ------ move loc in binLocList from 1 to new position after back picture
  173.   if count(gBinList) > 0 then
  174.     ------ add 2 to account for 1 to be deleted and 1 to go* behind* last pic
  175.     addAt(gBinLocList, min(4,(count(gBinList)+2)),getAt(gBinLocList,1))
  176.     deleteAt(gBinLocList,1)
  177.   end  if
  178. end
  179.  
  180. on moveBinPicsForward
  181.   --list already adjusted by placeOnWall or moveFrontToHOLD
  182.   set howMany = count(gBinList)
  183.   if  howMany > 0 then
  184.     repeat with x = 1 to min(3, howMany)
  185.       set the loc of sprite (38-x) = getAt(gBinLocList,x) --the loc of sprite (37-x)
  186.       set the member of sprite (38-x) = the member of sprite (37-x)
  187.       ------ potentially uses the member of sprite 34, temporarily, for sprite 35
  188.     end repeat
  189.     if howMany > 2 then
  190.       ----- get the next pic from list & show it
  191.       set picNo =  getAt(gBinList,3)
  192.       set the member of sprite 35 =  the number of member ("BN_"&picNo) of castLib "MUSEUM"
  193.       set the loc of sprite 35 = getAt(gBinLocList,3) 
  194.     else
  195.       ----- hide the back sprite, set back sprite to new loc
  196.       set the member of sprite (37-howMany) = gDot
  197.     end if
  198.   end if
  199. END
  200.  
  201. on dragAround chan
  202.   -- set the cursor of sprite chan = fist
  203.   puppetSprite 2, true
  204.   set the stretch of sprite 2 = TRUE
  205.   set the height of sprite 2 = (434 - (the height of the member of sprite chan)/2)
  206.   set the constraint of sprite chan = 2  --wallRect
  207.   updateStage
  208.   repeat while the mouseDown
  209.     set the loc of sprite chan = point(the mouseH, the mouseV)
  210.     updateStage
  211.   end repeat
  212.   -- set the constraint of sprite chan = 0  --none
  213.   set the stretch of sprite 2 = FALSE
  214.   puppetSprite 2, false
  215. END
  216.  
  217. on placeOnWall  picNo
  218.   ----- wall sprites begin at 22
  219.   set gPicsOnWall = gPicsOnWall + 1
  220.   set the cursor of sprite (21 + gPicsOnWall) = hand
  221.   set the loc of sprite (21 + gPicsOnWall) = the loc of sprite mMover
  222.   set the member of sprite (21 + gPicsOnWall) = the member of sprite mMover
  223.   ------ add to (current) roomList
  224.   addProp(value("gWallList"&gWallNo),picNo, the loc of sprite mMover)   --  "p1":point(x,y)
  225.   ------ update gMusList so changeCuration works correctly
  226.   deleteOne(gMusList, value("#" & picNo))
  227.   addProp (gMusList, value("#"&gWallNo), value("#" & picNo))
  228. END
  229.  
  230. on moveOnWall  chan
  231.   set picNo =  chars (the name of the member of sprite chan,4,7)  -- BN_P1
  232.   set the member of sprite mMover = the member of sprite chan
  233.   set the loc of sprite mmover = the loc of sprite chan
  234.   set the cursor of sprite chan = fist
  235.   set the member of sprite chan = gDot
  236.   dragAround mMover
  237.   if withinBin() then          --  sprite 33 = binBack
  238.     removeFromWall chan, picNo
  239.     moveBinPicsBackward
  240.     returnToBin picNo
  241.     
  242.   else
  243.     ------ revise loc in (current) roomList
  244.     set the member of sprite chan = the member of sprite mMover
  245.     set the loc of sprite chan = the loc of sprite mMover
  246.     setProp(value("gWallList"&gWallNo),picNo, the loc of sprite mmover)   --  "p1":point(x,y)
  247.   end if
  248.   set the cursor of sprite chan = hand
  249.   set the member of sprite mMover = gDot
  250.   updateStage
  251. END
  252.  
  253. on removeFromWall chan, picNo
  254.   ------ move the sprites forward to fill the gap
  255.   -- if gPicsOnWall = 0 then beep
  256.   repeat with c= chan to (21 + gPicsOnWall)  
  257.     set the loc of sprite c = the loc of sprite (c+1)
  258.     set the member of sprite c = the member of sprite (c+1)
  259.   end repeat
  260.   set the member of sprite (22 + gPicsOnWall) = gDot
  261.   set gPicsOnWall = gPicsOnWall - 1
  262.   ------ delete from (current) roomList  (gWallList1, etc)
  263.   deleteProp(value("gWallList"&gWallNo), picNo) 
  264.   ------ update gMusList so changeCuration works correctly
  265.   deleteOne(gMusList, value("#" & picNo))
  266.   addProp (gMusList, #bin, value("#" & picNo))
  267.   --   set the cursor  of sprite (22 + gPicsOnWall) = 0
  268. END
  269.  
  270. on moveBinPicsBackward
  271.   ------ SHIFT LOC LIST
  272.   ------ move loc in binLocList last to first
  273.   if count(gBinList) > 0 then
  274.     ----- take the loc at position 3 (last) and add it at position 1, then delete the last
  275.     addAt(gBinLocList,1,getAt(gBinLocList,3))
  276.     deleteAt(gBinLocList,4)
  277.   end  if
  278.   ----- SHIFT PIC SPRITES
  279.   set howMany = count(gBinList)
  280.   if  howMany > 0 then
  281.     repeat with x =  min(2, howMany)  down to 1
  282.       ------ counting down 3,2,1 in locList (sprite 13--> position 1, etc)
  283.       ------ e.g. if 2 then set loc of 35  = (getAt  pos 3)
  284.       set the loc of sprite (37-x) = getAt(gBinLocList,x+1) 
  285.       ------ sets member of backMost sprite first
  286.       ------ e.g. if 2 then set member of 35 = member of 36, then member of 36 = member of 37
  287.       set the member of sprite (37-x) = the member of sprite (38-x)
  288.     end repeat
  289.   end if
  290. END
  291.  
  292. on returnToBin picNo
  293.   ------ add to front of BinList
  294.   addAt(gBinList,1, picNo)
  295.   set howmany = count(gBinList)
  296.   ------ show at FRONT of bin
  297.   set the member of sprite 37 = the number of member ("BN_"&picNo) of castLib "MUSEUM"
  298.   set the loc of sprite 37 = getAt(gBinLocList,1)
  299. END
  300.  
  301. on musNav dir
  302.   repeat while the mouseDown
  303.   end repeat
  304.   if rollover (the clickon) then
  305.     cursor 4
  306.     set gWallNo = gWallNo + dir
  307.     if gWallNo > 5 then set gWallNo = 1
  308.     if gWallNo < 1 then set gWallNo = 5
  309.     changeMuseumRoom
  310.   end if
  311.   -- cursor 0
  312. end
  313.  
  314. on closeMuseum
  315.   repeat with x = 35 to 37
  316.     puppetSprite x, FALSE
  317.     set the cursor of sprite x = 0
  318.   end repeat
  319.   repeat with x = 22 to 31
  320.     puppetSprite x, FALSE
  321.     set the cursor of sprite x = 0
  322.   end repeat
  323.   set the stretch of sprite 33 = 0
  324.   set the constraint of sprite mMover = 0 --none
  325.   set the cursor of sprite mMover = 0 --none
  326. end
  327.  
  328. on SaveMuseumInfoToLib
  329.   put gMusList into line 2 of field "museumInfo" of castLib "USER"
  330.   put  gBinList into line 4 of field "museumInfo" of castLib "USER"
  331.   put gWallList1 into line 6 of field "museumInfo" of castLib "USER"
  332.   put gWallList2 into line 8 of field "museumInfo" of castLib "USER"
  333.   put gWallList3 into line 10 of field "museumInfo" of castLib "USER"
  334.   put gWallList4 into line 12 of field "museumInfo" of castLib "USER"
  335.   put gWallList5 into line 14 of field "museumInfo" of castLib "USER"
  336. end
  337.